﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head> 
  <meta charset="UTF-8" /> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 
  <title>炽热课表</title> 
  <link rel="stylesheet" href="style/bootstrap.min.css" /> 
  <link rel="stylesheet" href="style/documentation.css" /> 
  <!-- 
       files --> 
  <link rel="stylesheet" href="jalendar/style/jalendar.css" type="text/css" /> 
  <script type="text/javascript" src="jalendar/js/jquery-1.10.2.min.js"></script>
  <!--jQuery--> 
  <script type="text/javascript" src="jalendar/js/jalendar.min.js"></script> 
  <!-- Jalendar files #end --> 
  <link rel="stylesheet" href="style/default.min.css" media="screen" type="text/css" /> 
  <script src="js/highlight.pack.js"></script> 
  <script src="js/documentation.js"></script> 
  <script type="text/javascript">
      // 获取code
      function GetQueryString(name) {
          var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
          var r = window.location.search.substr(1).match(reg); //search,查询？后面的参数，并匹配正则
          if (r != null) return unescape(r[2]);
          return null;
      }

      // 主方法
      function mainManager() {
          getWechatInfo();           // 获取微信信息
      }

      // 1.获取微信信息
      function getWechatInfo() {
          var code = GetQueryString('code');
          var openid = GetQueryString('openid');
          if (openid.length > 0) {
              getEventListManager();
          } else {
              var args = $.param({
                  "code": code
              })
              $.ajax({
                  url: '../../ChireInter/Wechat/wechat_auth.ashx',
                  data: args,
                  type: 'post',
                  dataType: 'json',
                  success: function (res) {
                      if (res.errCode == 200) {
                          getEventListManager();
                      } else {

                      }
                  },
                  error: function (err) {

                  }
              })
          }
      }

      function getEventListManager() {
          var code = GetQueryString('code');
          var openid = GetQueryString('openid');
          var args = $.param({
              "code": code,
              "openid": openid,
          })
          $.ajax({
              url: '../../ChireInter/Event_calendar/Event_List_Wechat.ashx',
              data: args,
              type: 'post',
              dataType: 'json',
              success: function (res) {
                  if (res.errCode == 200) {
                      var html = "";

                      for (var i in res.data.list) {
                          html += "<div class=\"added-event\" data-date=\""+res.data.list[i].date +"\" data-title=" + "\"" + res.data.list[i].title + "\"" + "></div> ";
                      }
                      var oContent = $('#yourId')
                      oContent.prepend(html);

                      $('#yourId').jalendar({
                          color: '#577e9a', // Unlimited Colors
                          color2: '#57c8bf', // Unlimited Colors
                          lang: 'CN',
                      });
                  }
              },
              error: function (err) {

              }
          })

      }


      $(function () {
          $('#yourId2').jalendar({
              color: '#fff',
              type: 'linker',
              customUrl: 'http://sc.chinaz.com/?var=',
              dateType: 'mm-dd-yyyy',
              
          });

          $('#yourId3').jalendar({
              type: 'selector',
              dateType: 'yyyy-mm-dd',
              done: function () {
                  alert($('#yourId3 input.data1').val());
              }
          });

          $('#yourId4').jalendar({
              customDay: '04/03/1987',
              color: '#52D3D5',
              color2: '#52D5A4',
              type: 'range',
              lang: 'TR',
              done: function () {
                  alert($('#yourId4 input.data1').val() + ' / ' + $('#yourId4 input.data2').val());
              }
          });
      });
</script> 
 </head> 
 <body onload ="mainManager()"> 
  <div class="container-fluid"> 
   <div class="col-sm-4"> 
    <div id="yourId" class="jalendar"> 


        </div> 
   </div> 
    
  </div>   
 </body>
</html>